home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
vbdatabs
/
strdbw.h
< prev
next >
Wrap
C/C++ Source or Header
|
1999-03-28
|
15KB
|
455 lines
// ------------------------------- //
// -------- Start of File -------- //
// ------------------------------- //
// ----------------------------------------------------------- //
// C++ Header File Name: strdbw.h
// Compiler Used: MSVC40, HP CPP 10.24
// Produced By: Doug Gaer
// File Creation Date: 12/16/1997
// Date Last Modified: 03/29/1999
// Copyright (c) 1997 Douglas M. Gaer
// ----------------------------------------------------------- //
// ---------- Include File Description and Details ---------- //
// ----------------------------------------------------------- //
/*
The VBD C++ classes are copyright (c) 1997, by Douglas M. Gaer.
All those who put this code or its derivatives in a commercial
product MUST mention this copyright in their documentation for
users of the products in which this code or its derivative
classes are used. Otherwise, you have the freedom to redistribute
verbatim copies of this source code, adapt it to your specific
needs, or improve the code and release your improvements to the
public provided that the modified files carry prominent notices
stating that you changed the files and the date of any change.
THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.
THE ENTIRE RISK OF THE QUALITY AND PERFORMANCE OF THIS SOFTWARE
IS WITH YOU. SHOULD ANY ELEMENT OF THIS SOFTWARE PROVE DEFECTIVE,
YOU WILL ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR
CORRECTION.
The string database is a general purpose object-oriented
database. This version is designed to work with the wxWindow
GUI library version 1.68
- Modify "dbconfig.h" file to customize the database
- Modify "dbvers.h" file to uniquely identify the database
- Modify "dbtcfg.h" file to customize this program
- Modify "version.h" file to report changes and fixes
*/
// ----------------------------------------------------------- //
#ifndef __STRDBW_HPP__
#define __STRDBW_HPP__
#include "strdb.h"
#include "config.h"
#include "dbconfig.h"
#include "timer.h"
#include "version.h"
#include "dbtcfg.h"
#include "strdb_sh.h"
#include "pscript.h"
#include "htmldrv.h"
#ifdef __GNUG__
#pragma implementation
#pragma interface
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx_prec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx.h"
#endif
// Define this macro to use the wxWindows printing features under
// Microsoft Windows. A separate PostScript driver is provided for
// UNIX system. Define this macro for UNIX compiles to enable MSW
// style printing in motif using wxWindow 1.68B.
// #ifndef __USE_MSW_PRINTING__
// #define __USE_MSW_PRINTING__
// #endif
#ifdef __USE_MSW_PRINTING__
// Setup wxWindows printing for MSW
#if !USE_PRINTING_ARCHITECTURE
#error You must set USE_PRINTING_ARCHITECTURE to 1 in wx_setup.h to compile
#endif
#include "wx_mf.h"
#include "wx_print.h"
#endif // __USE_MSW_PRINTING__
// Define new frame types for wxWindow frames and sub-frames
class MyFrame; // Main window frame
class MyTextWindow; // Text windos frames
class MyText; // Class used to encapsulate wxText objects
// Define configurable parameters
int CacheSize = 15; // Memory cache size for the index file
int AdminRights = 0; // Define user privileges
// Define file access modes used in the application
VBDFile::AccessMode RWMode = VBDFile::READWRITE;
VBDFile::AccessMode ROMode = VBDFile::READONLY;
// Function prototypes for wxWindows controls
void AddBtnProc(wxButton& but, wxCommandEvent& event);
void ClearAddPanel();
void ChBtnProc(wxButton& but, wxCommandEvent& event);
void ClearChangePanel();
void DsBtnProc(wxButton& but, wxCommandEvent& event);
void ClearDisplayPanel();
void text_proc(wxText &but, wxCommandEvent &event);
#ifdef __USE_MSW_PRINTING__
void page_btn_proc(wxButton& but, wxCommandEvent& event);
#endif // __USE_MSW_PRINTING__
// File menu functions
void ExportToASCII(MyTextWindow &textWin);
void ImportFromASCII(MyTextWindow &textWin);
void BackUp(MyTextWindow &textWin);
void Merge(MyTextWindow &textWin);
void CreateTemplate(MyTextWindow &textWin);
void CompareIndexFile(MyTextWindow &textWin);
void RebuildIndexFile(MyTextWindow &textWin);
// Database menu functions
void Add(MyTextWindow &textWin);
void Change(MyTextWindow &textWin);
void Remove(MyTextWindow &textWin, char *keyNM = 0);
void DisplayDB(MyTextWindow &textWin);
// Find menu functions
void FindBy(MyTextWindow &textWin, const char *MemberName, StrDBItem item);
// Print menu functions
void ASCIIPrintAll(MyTextWindow &textWin); // Print abbreviated listing
void ASCIIPrintAllLong(MyTextWindow &textWin); // Print full listing
void ASCIIPrintObject(MyTextWindow &textWin, char *keyNM = 0);
void PostScriptPrint(MyTextWindow & textWin);
void HTMLPrint(MyTextWindow & textWin);
// View menu functions
void Clear(MyTextWindow &textWin);
// Function prototypes for non-menu functions
void DisplayObject(StrDB &strdb);
int LoadIndexKeys();
enum PrintMode {
PORTRAIT,
LANDSCAPE
};
void PrintItemBar(ofstream &stream, int abv = 1);
void PrintLineByLine(StrDB &strdb, ofstream &stream, int abv = 1);
int ASCIIPrint(PrintMode mode, MyTextWindow &textWin);
void PrintObject(StrDB &strdb, MyTextWindow &textWin);
int PrintPSItemBar(ofstream &stream, PostScriptDrv &psdrv,
int x_offset, int char_offset, int max_len);
// Search functions
void StrDBSearch(StrDB &strdb, StrDBItem item, UString &str,
MyTextWindow &textWin, const char *wildcard = 0);
// Version number for this windows program
char *VerNumber();
// Control key macro used for wxWindows key events
#define CONTROL(c) ((c) & 037)
// Identification for the all wxWindows main menu functions
enum MainMenu {
// File menu constants
FILE_QUIT = 1,
FILE_VBDSTATS,
FILE_EXPORT,
FILE_IMPORT,
FILE_BACKUP,
FILE_MERGE,
FILE_TEMPLATE,
FILE_COMPARE_INDEX,
FILE_REBUILD_INDEX,
// Edit menu constants
EDIT_CUT,
EDIT_COPY,
EDIT_PASTE,
// Database menu constants
DB_DISPLAY,
DB_ADD,
DB_CHANGE,
DB_REMOVE,
// Find menu constants
FIND_BYKEYNAME,
FIND_BYM2NAME,
FIND_BYM3NAME,
FIND_BYM4NAME,
FIND_BYM5NAME,
FIND_BYM6NAME,
FIND_BYM7NAME,
FIND_BYM8NAME,
FIND_BYCOMMENTS,
// Print menu constants
WXPRINT_PRINT,
WXPRINT_PRINTER_SETUP,
WXPRINT_PREVIEW,
WXPRINT_PAGE_SETUP,
PRINT_POSTSCRIPT,
PRINT_HTML,
PRINT_ASCIIALL,
PRINT_ASCIILONG,
PRINT_ASCIIOBJECT,
// View menu constants
VIEW_CLEAR,
// Help menu constants
HELP_ABOUT,
HELP_USERLEVEL
};
// Define control button tags for wxWindow panel buttons
#define ADD_BUTTON_ADD 1
#define ADD_BUTTON_CANCEL 2
#define ADD_BUTTON_CLOSE 3
#define ADD_BUTTON_REVERT 4
#define CHANGE_BUTTON_CM 11
#define CHANGE_BUTTON_CANCEL 12
#define CHANGE_BUTTON_CLOSE 13
#define CHANGE_BUTTON_REVERT 14
#define CHANGE_BUTTON_SH 15
#define DISPLAY_BUTTON_NX 21
#define DISPLAY_BUTTON_PREV 22
#define DISPLAY_BUTTON_CHANGE 23
#define DISPLAY_BUTTON_CLOSE 24
#define DISPLAY_BUTTON_REMOVE 25
#ifdef __USE_MSW_PRINTING__
#define PAGE_DIALOG_BUTTON_CLOSE 400
#define PAGE_DIALOG_BUTTON_ACCEPT 401
#define PAGE_DIALOG_BUTTON_CANCEL 402
#define PAGE_DIALOG_BUTTON_DEFAULT 403
#endif // __USE_MSW_PRINTING__
// Define a new text subwindow that can respond to drag-and-drop
class MyTextWindow: public wxTextWindow
{
public:
MyTextWindow(wxFrame *frame, int x=-1, int y=-1, int width=-1, int height=-1,
long style=0):
wxTextWindow(frame, x, y, width, height, style) { DragAcceptFiles(TRUE); }
public:
void OnDropFiles(int n, char *files[], int x, int y) { LoadFile(files[0]); }
void OnChar(wxKeyEvent& event);
};
// Define a new application type
class MyApp: public wxApp
{
public:
wxFrame *OnInit();
};
// Define a new frame type
class MyFrame: public wxFrame
{
public:
MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
public:
void OnMenu